Optimize thread locks and expiring cache for Enhanced Monitoring plugin#356
Merged
Conversation
karenc-bq
reviewed
Jan 31, 2023
karenc-bq
reviewed
Jan 31, 2023
2f85114 to
758aa81
Compare
expiring cache
758aa81 to
67627c5
Compare
congoamz
reviewed
Jan 31, 2023
verify cluster status before each test increase session token expiration time
d5500ba to
f387f13
Compare
congoamz
reviewed
Feb 3, 2023
| // Check for min delay between node health check | ||
| if (delayMillis < MIN_CONNECTION_CHECK_TIMEOUT_MILLIS) { | ||
| delayMillis = MIN_CONNECTION_CHECK_TIMEOUT_MILLIS; | ||
| } |
Contributor
There was a problem hiding this comment.
should the elapsedTime subtraction come after this reset to the MIN_CONNECTION timeout? For example, if we spent 1s on the status check and the MIN_CONNECTION timeout is 3s, we only have to wait 2s
Contributor
Author
There was a problem hiding this comment.
I was thinking about this scenario but I guess it makes sense to avoid checking node status too often. So MIN_CONNECTION is applied to delayMillis.
congoamz
approved these changes
Feb 3, 2023
karenc-bq
reviewed
Feb 4, 2023
Comment on lines
+49
to
+59
| CacheItem<V> cacheItem = cache.computeIfPresent(key, (kk, vv) -> vv.isExpired() ? null : vv); | ||
| return cacheItem == null ? null : cacheItem.item; | ||
| } | ||
|
|
||
| public V get(final K key, final V defaultItemValue, long itemExpirationNano) { | ||
| CacheItem<V> cacheItem = cache.compute(key, | ||
| (kk, vv) -> (vv == null || vv.isExpired()) | ||
| ? new CacheItem<>(defaultItemValue, System.nanoTime() + itemExpirationNano) | ||
| : vv); | ||
| return cacheItem.item; | ||
| } |
Contributor
There was a problem hiding this comment.
I think these methods can be simplified if you add a getter for cacheItem.item:
public V getItem() {
return isExpired() ? null : item;
}
karenc-bq
reviewed
Feb 4, 2023
karenc-bq
reviewed
Feb 4, 2023
Co-authored-by: Karen <64801825+karenc-bq@users.noreply.github.com>
Co-authored-by: Karen <64801825+karenc-bq@users.noreply.github.com>
Contributor
|
This PR address #333 |
sergiyvamz
pushed a commit
to aws/aws-advanced-jdbc-wrapper
that referenced
this pull request
Mar 20, 2023
Porting over optimizations from the aws-mysql-jdbc driver: awslabs/aws-mysql-jdbc#356 ### By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Aaron Congo <Aaron.Congo@improving.com> Co-authored-by: sergiyv-bitquill <sergiyv@bitquilltech.com>
|
this fix have bug will case #412 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Optimize thread locks and expiring cache for Enhanced Monitoring plugin.
Description
Additional Reviewers
@karenc-bq
@congoamz